package com.ruoyi.finance.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.finance.mapper.EAccountMapper;
import com.ruoyi.finance.domain.EAccount;
import com.ruoyi.finance.service.IEAccountService;

/**
 * 账户信息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-11-21
 */
@Service
public class EAccountServiceImpl implements IEAccountService
{
    @Autowired
    private EAccountMapper eAccountMapper;

    /**
     * 查询账户信息
     *
     * @param id 账户信息主键
     * @return 账户信息
     */
    @Override
    public EAccount selectEAccountById(Integer id)
    {
        return eAccountMapper.selectEAccountById(id);
    }

    /**
     * 查询账户信息列表
     *
     * @param eAccount 账户信息
     * @return 账户信息
     */
    @Override
    public List<EAccount> selectEAccountList(EAccount eAccount)
    {

        return eAccountMapper.selectEAccountList(eAccount);
    }

    /**
     * 新增账户信息
     *
     * @param eAccount 账户信息
     * @return 结果
     */
    @Override
    public int insertEAccount(EAccount eAccount)
    {
        return eAccountMapper.insertEAccount(eAccount);
    }

    /**
     * 修改账户信息
     *
     * @param eAccount 账户信息
     * @return 结果
     */
    @Override
    public int updateEAccount(EAccount eAccount)
    {
        return eAccountMapper.updateEAccount(eAccount);
    }

    /**
     * 批量删除账户信息
     *
     * @param ids 需要删除的账户信息主键
     * @return 结果
     */
    @Override
    public int deleteEAccountByIds(Integer[] ids)
    {
        return eAccountMapper.deleteEAccountByIds(ids);
    }

    /**
     * 删除账户信息信息
     *
     * @param id 账户信息主键
     * @return 结果
     */
    @Override
    public int deleteEAccountById(Integer id)
    {
        return eAccountMapper.deleteEAccountById(id);
    }

    @Override
    public int updateStatus1(Integer id) {

        EAccount eAccount = eAccountMapper.selectEAccountById(id);

        if (eAccount.getStatus()==0){
            eAccount.setStatus(1);
        }
        return  eAccountMapper.updateEAccount(eAccount);
    }

    @Override
    public int updateStatus2(Integer id) {

        EAccount eAccount = eAccountMapper.selectEAccountById(id);

        if (eAccount.getStatus()==1){
            eAccount.setStatus(0);
        }

        return  eAccountMapper.updateEAccount(eAccount);
    }


    @Override
    public int updateStatusById(Integer id) {
        return eAccountMapper.updateStatusById(id);
    }

    @Override
    public EAccount selectEAccountByPid(Integer id) {
        return eAccountMapper.selectEAccountByPid(id);
    }
}
